package com.ysd.entity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Email;

/**
 * 用户
 * 
 * @author dzj20
 *
 */
public class User {
	private Integer uid; // 用户编号
	
	@NotNull(message = "用户名不能为空")
	private String username; // 用户名
	private String password; // 账号
	@Pattern(regexp = "^1[0-9]{10}$",message = "请填入正确的手机号" )
	private String phone; // 手机号
	private String birthday; // 生日
	
	@Email(message = "邮箱格式错误")
	private String email; // 邮箱
	private Integer defaultAddress; // 默认地址,是address的外键

	public Integer getUid() {
		return uid;
	}

	public void setUid(Integer uid) {
		this.uid = uid;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Integer getDefaultAddress() {
		return defaultAddress;
	}

	public void setDefaultAddress(Integer defaultAddress) {
		this.defaultAddress = defaultAddress;
	}

	public User(Integer uid, String username, String password, String phone, String birthday, String email,
			Integer defaultAddress) {
		super();
		this.uid = uid;
		this.username = username;
		this.password = password;
		this.phone = phone;
		this.birthday = birthday;
		this.email = email;
		this.defaultAddress = defaultAddress;
	}

	public User() {
		super();
	}

	@Override
	public String toString() {
		return "User [uid=" + uid + ", username=" + username + ", password=" + password + ", phone=" + phone
				+ ", birthday=" + birthday + ", email=" + email + ", defaultAddress=" + defaultAddress + "]";
	}

}
